<?php
/**
 * Created by PhpStorm.
 * User: 王泽锋
 * Date: 2018/03/09
 * Time: 11:26
 */

namespace app\home\model;


use think\Model;

class Shopping_commodity extends Model {
    //首页获取已推送的数据
    public function get_list($where,$length=0){
        $list = $this->where($where)->order('create_time','desc')->limit($length,12)->select();
        foreach($list as $value){
//            $value['create_time'] = date('Y-m-d',$value['create_time']);
            $value['front_cover'] = get_covers($value['front_cover']);
        }
        return $list;
    }

    public function get_lists($where,$length=0){
        $list = $this->where($where)->order('create_time','desc')->limit($length,6)->select();
        foreach($list as $value){
//            $value['create_time'] = date('Y-m-d',$value['create_time']);
            $value['front_cover'] = get_covers($value['front_cover']);
        }
        return $list;
    }

    public function getList($search)
    {
        $map['title'] = ['like', '%' . $search . '%'];
        $map['status'] = 0;
        $list = $this->where($map)->order('create_time','desc')->select();
        return $list;
    }
}